package com.jh.user.pojo;


import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.jh.user.pojo.enums.ChannelMerType;
import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * @author Yichuan
 * @version 1.0
 */
public class ChannelVO {

    private static final long serialVersionUID = 6572236769587556557L;

    public static ChannelVO transform(Channel channel) {
        ChannelVO vo = new ChannelVO();
        vo.setId(channel.getId());
        vo.setChannelTag(channel.getChannelTag());
        vo.setRemarks(channel.getRemarks());
        vo.setExtendedField(channel.getExtendedField());
        vo.setChannelParams(channel.getChannelParams());
        vo.setChannelNo(channel.getChannelNo());
        vo.setNotifyURL(channel.getNotifyURL());
        vo.setReturnURL(channel.getReturnURL());
        vo.setAutoclearing(channel.getAutoclearing());
        vo.setChannelType(channel.getChannelType());
        vo.setName(channel.getName());
        vo.setSubChannelTag(channel.getSubChannelTag());
        vo.setSubName(channel.getSubName());
        vo.setSingleMinLimit(channel.getSingleMinLimit());
        vo.setSingleMaxLimit(channel.getSingleMaxLimit());
        vo.setEveryDayMaxLimit(channel.getEveryDayMaxLimit());
        vo.setMinwithdrawFee(channel.getMinwithdrawFee());
        vo.setMinextrafee(channel.getMinextrafee());
        vo.setStartTime(channel.getStartTime());
        vo.setEndTime(channel.getEndTime());
        vo.setCostRate(channel.getCostRate());
        vo.setRate(channel.getRate());
        vo.setPayType(channel.getPayType());
        vo.setExtraFee(channel.getExtraFee());
        vo.setWithdrawFee(channel.getWithdrawFee());
        vo.setStatus(channel.getStatus());
        vo.setLog(channel.getLog());
        vo.setAmountMoney(channel.getAmountMoney());
        vo.setMoney(channel.getMoney());
        vo.setCoinType(channel.getCoinType());
        vo.setCreateTime(channel.getCreateTime());
        if (StringUtils.isNotBlank(channel.getChannelMerType())){
            vo.setChannelMerType(ChannelMerType.of(channel.getChannelMerType()).getDesc());
        }
        return vo;
    }

    public static List<ChannelVO> transform(List<Channel> rateList) {
        if (rateList == null || rateList.isEmpty()) {
            return ImmutableList.of();
        }
        List<ChannelVO> result = Lists.newLinkedList();
        for (Channel channel: rateList) {
            result.add(ChannelVO.transform(channel));
        }
        return result;
    }

    private long id;

    private String channelTag;

    private String remarks;

    private String extendedField;
    private String channelParams = "D0";
    private String channelNo;
    private String notifyURL;
    private String returnURL;
    private String autoclearing = "0";
    private String channelType;
    private String name;
    private String subChannelTag;
    private String subName;
    private BigDecimal singleMinLimit;
    private BigDecimal singleMaxLimit;
    private BigDecimal everyDayMaxLimit;
    private BigDecimal minwithdrawFee;
    private BigDecimal minextrafee ;
    private String startTime;
    private String endTime;
    private String costRate;
    private BigDecimal rate;
    private String payType;
    private BigDecimal extraFee;
    private BigDecimal withdrawFee = BigDecimal.ZERO;
    private String status = "1";
    private String log;
    private BigDecimal amountMoney;
    private BigDecimal money;
    private String coinType = "0";
    private Date createTime;
    private String channelMerType;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getAutoclearing() {
        return autoclearing;
    }

    public void setAutoclearing(String autoclearing) {
        this.autoclearing = autoclearing;
    }

    public String getChannelTag() {
        return channelTag;
    }

    public void setChannelTag(String channelTag) {
        this.channelTag = channelTag;
    }

    public String getChannelNo() {
        return channelNo;
    }

    public void setChannelNo(String channelNo) {
        this.channelNo = channelNo;
    }

    public BigDecimal getMinwithdrawFee() {
        return minwithdrawFee;
    }

    public void setMinwithdrawFee(BigDecimal minwithdrawFee) {
        this.minwithdrawFee = minwithdrawFee;
    }

    public BigDecimal getMinextrafee() {
        return minextrafee;
    }

    public void setMinextrafee(BigDecimal minextrafee) {
        this.minextrafee = minextrafee;
    }

    public BigDecimal getExtraFee() {
        return extraFee;
    }

    public void setExtraFee(BigDecimal extraFee) {
        this.extraFee = extraFee;
    }

    public BigDecimal getWithdrawFee() {
        return withdrawFee;
    }

    public void setWithdrawFee(BigDecimal withdrawFee) {
        this.withdrawFee = withdrawFee;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSubChannelTag() {
        return subChannelTag;
    }

    public void setSubChannelTag(String subChannelTag) {
        this.subChannelTag = subChannelTag;
    }

    public String getSubName() {
        return subName;
    }

    public void setSubName(String subName) {
        this.subName = subName;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public BigDecimal getSingleMinLimit() {
        return singleMinLimit;
    }

    public void setSingleMinLimit(BigDecimal singleMinLimit) {
        this.singleMinLimit = singleMinLimit;
    }

    public BigDecimal getSingleMaxLimit() {
        return singleMaxLimit;
    }

    public void setSingleMaxLimit(BigDecimal singleMaxLimit) {
        this.singleMaxLimit = singleMaxLimit;
    }

    public BigDecimal getEveryDayMaxLimit() {
        return everyDayMaxLimit;
    }

    public void setEveryDayMaxLimit(BigDecimal everyDayMaxLimit) {
        this.everyDayMaxLimit = everyDayMaxLimit;
    }

    public BigDecimal getRate() {
        return rate;
    }

    public void setRate(BigDecimal rate) {
        this.rate = rate;
    }

    public String getChannelParams() {
        return channelParams;
    }

    public void setChannelParams(String channelParams) {
        this.channelParams = channelParams;
    }

    public String getNotifyURL() {
        return notifyURL;
    }

    public void setNotifyURL(String notifyURL) {
        this.notifyURL = notifyURL;
    }

    public String getReturnURL() {
        return returnURL;
    }

    public void setReturnURL(String returnURL) {
        this.returnURL = returnURL;
    }

    public String getChannelType() {
        return channelType;
    }

    public void setChannelType(String channelType) {
        this.channelType = channelType;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getLog() {
        return log;
    }

    public void setLog(String log) {
        this.log = log;
    }

    public String getExtendedField() {
        return extendedField;
    }

    public void setExtendedField(String extendedField) {
        this.extendedField = extendedField;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    public String getStartTime() {
        return startTime;
    }

    public void setStartTime(String startTime) {
        this.startTime = startTime;
    }

    public String getEndTime() {
        return endTime;
    }

    public void setEndTime(String endTime) {
        this.endTime = endTime;
    }

    public String getCoinType() {
        return coinType;
    }

    public void setCoinType(String coinType) {
        this.coinType = coinType;
    }

    public String getCostRate() {
        return costRate;
    }

    public void setCostRate(String costRate) {
        this.costRate = costRate;
    }

    public String getPayType() {
        return payType;
    }

    public void setPayType(String payType) {
        this.payType = payType;
    }

    public BigDecimal getAmountMoney() {
        return amountMoney;
    }

    public void setAmountMoney(BigDecimal amountMoney) {
        this.amountMoney = amountMoney;
    }

    public BigDecimal getMoney() {
        return money;
    }

    public void setMoney(BigDecimal money) {
        this.money = money;
    }

    public String getChannelMerType() {
        return channelMerType;
    }

    public void setChannelMerType(String channelMerType) {
        this.channelMerType = channelMerType;
    }
}
